Skip to content

Conversation

@Nadrieril
Copy link
Member

@Nadrieril Nadrieril commented Dec 4, 2025

I'm entirely new to bootstrap but there seemed to be no easy way to construct a sysroot with tools and librustc_driver.so. ./x install is the command for that but as far as I can tell it doesn't include the rustc-dev files. This is my attempt at adding that.

./x install rustc-dev now does what you expect (at least on my machine™). If I'm understanding correctly this also means that ./x install will now include rustc-dev files if build.tools contains "rustc-dev".

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Dec 4, 2025
@rustbot
Copy link
Collaborator

rustbot commented Dec 4, 2025

r? @jieyouxu

rustbot has assigned @jieyouxu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-2 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
##[group]Installing src for x86_64-unknown-linux-gnu
##[endgroup]
##[group]Building stage2 codegen backend cranelift (stage1 -> stage2, x86_64-unknown-linux-gnu)
##[endgroup]
skipping Install CodegenBackend("cranelift") stage2 (x86_64-unknown-linux-gnu)
##[group]Building stage2 llvm-bitcode-linker (stage1 -> stage2, x86_64-unknown-linux-gnu)
##[endgroup]
Dist llvm-bitcode-linker-1.93.0-dev-x86_64-unknown-linux-gnu
##[group]Installing stage2 llvm-bitcode-linker (stage1 -> stage2, x86_64-unknown-linux-gnu)
##[endgroup]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Snapshot Summary ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Snapshot: install_extended
Source: src/bootstrap/src/core/builder/tests.rs:2863
────────────────────────────────────────────────────────────────────────────────
Expression: ctx.config("install").args(&["--set",
&format!("install.prefix={}", ctx.dir().display()).replace("\\", "/"),
"--set",
&format!("install.sysconfdir={}", ctx.dir().display()).replace("\\", "/"),
"--set", "build.extended=true", "--build", "x86_64-unknown-linux-gnu",
"--host",
"x86_64-unknown-linux-gnu"]).get_steps().render_with(RenderConfig
{ normalize_host: false })
────────────────────────────────────────────────────────────────────────────────
-old snapshot
+new results
────────────┬───────────────────────────────────────────────────────────────────
   33    33 │ [build] rustdoc 2 <x86_64-unknown-linux-gnu>
   34    34 │ [build] rustc 1 <x86_64-unknown-linux-gnu> -> rust-analyzer-proc-macro-srv 2 <x86_64-unknown-linux-gnu>
   35    35 │ [build] rustc 0 <x86_64-unknown-linux-gnu> -> GenerateCopyright 1 <x86_64-unknown-linux-gnu>
   36    36 │ [dist] rustc <x86_64-unknown-linux-gnu>
         37 │+[dist] rustc 1 <x86_64-unknown-linux-gnu> -> rustc-dev 2 <x86_64-unknown-linux-gnu>
   37    38 │ [build] rustc 1 <x86_64-unknown-linux-gnu> -> cargo 2 <x86_64-unknown-linux-gnu>
   38    39 │ [dist] rustc 1 <x86_64-unknown-linux-gnu> -> cargo 2 <x86_64-unknown-linux-gnu>
   39    40 │ [build] rustc 1 <x86_64-unknown-linux-gnu> -> rust-analyzer 2 <x86_64-unknown-linux-gnu>
   40    41 │ [dist] rustc 1 <x86_64-unknown-linux-gnu> -> rust-analyzer 2 <x86_64-unknown-linux-gnu>
────────────┴───────────────────────────────────────────────────────────────────
Stopped on the first failure. Run `cargo insta test` to run all snapshots.

thread 'core::builder::tests::snapshot::install_extended' (13226) panicked at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13:
snapshot assertion for 'install_extended' failed in line 2863
stack backtrace:
   0: __rustc::rust_begin_unwind
             at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/std/src/panicking.rs:698:5
   1: core::panicking::panic_fmt
             at /rustc/3b4dd9bf1410f8da6329baa36ce5e37673cbbd1f/library/core/src/panicking.rs:80:14
   2: <insta::runtime::SnapshotAssertionContext>::finalize
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:679:13
   3: insta::runtime::assert_snapshot
             at /cargo/registry/src/index.crates.io-1949cf8c6b5b557f/insta-1.43.1/src/runtime.rs:848:13
   4: bootstrap::core::builder::tests::snapshot::install_extended
             at ./src/core/builder/tests.rs:2863:9
   5: bootstrap::core::builder::tests::snapshot::install_extended::{closure#0}
             at ./src/core/builder/tests.rs:2861:26
   6: <bootstrap::core::builder::tests::snapshot::install_extended::{closure#0} as core::ops::function::FnOnce<()>>::call_once

@Kobzol
Copy link
Member

Kobzol commented Dec 4, 2025

a sysroot with tools and librustc_driver.so

You mean a sysroot that has compiler rlibs available? rustc-dev is a very special component useful only for tools that leverage rustc_private. Otherwise a sysroot with tools and librustc_driver.so should be easily buildable with build.extended = true and ./x dist.

@anforowicz
Copy link
Contributor

a sysroot with tools and librustc_driver.so

You mean a sysroot that has compiler rlibs available? rustc-dev is a very special component useful only for tools that leverage rustc_private. Otherwise a sysroot with tools and librustc_driver.so should be easily buildable with build.extended = true and ./x dist.

IIUC dist will only build a tarball (right?). Chromium depends on install to actually put things into a directory that is then packaged and distributed using a custom (GCS) system. So I think this PR would still be useful to Chromium. See https://crbug.com/460482110 for more details and background.

The job aarch64-gnu-llvm-20-2 failed!

IIUC we just need to update the golden/expected snapshots - i.e. add [dist] rustc 1 <x86_64-unknown-linux-gnu> -> rustc-dev 2 <x86_64-unknown-linux-gnu> right below

[dist] rustc <x86_64-unknown-linux-gnu>

@jieyouxu
Copy link
Member

jieyouxu commented Dec 4, 2025

I'm a bit hesistant on adding ./x install rustc-dev, since like Jakub said, that dist component is intended for rustc_private tools, so its not clear to me what ./x install rustc-dev is supposed to mean. I'll pull this into a bootstrap zulip thread a bit later.

EDIT: oh, I guess it's #general > Help building and **installing** `rustc_driver` et al
EDIT 2: discussing in #t-infra/bootstrap > ./x install rustc-dev?.

@jieyouxu jieyouxu added S-waiting-on-t-bootstrap Status: Awaiting decision from T-bootstrap. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 5, 2025
@anforowicz
Copy link
Contributor

The job aarch64-gnu-llvm-20-2 failed!

IIUC we just need to update the golden/expected snapshots - i.e. add [dist] rustc 1 <x86_64-unknown-linux-gnu> -> rustc-dev 2 <x86_64-unknown-linux-gnu> right below

[dist] rustc <x86_64-unknown-linux-gnu>

@Nadrieril, could you try running the following commands to update the test expectations?

$ cd src/bootstrap
$ cargo insta test
$ cargo insta review # only a single diff needs explicit acceptance/approval

(h/t @Kobzol - thanks for sharing these commands).


I can confirm that after the following steps:

  • Patching in this PR into my local Rust build,
  • Editing config.toml to include rustc-dev and rust-std
  • Running ./x.py install

I can now successfully build Crubit with:

  • tools/crates/run_cargo.py -Z unstable-options -C ~/src/github/crubit clean
  • tools/crates/run_cargo.py -Z unstable-options -C ~/src/github/crubit build --verbose --bin cc_bindings_from_rs --release

So this PR is definitely helping in my scenario.

@jieyouxu jieyouxu added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-t-bootstrap Status: Awaiting decision from T-bootstrap. labels Dec 11, 2025
@jieyouxu
Copy link
Member

jieyouxu commented Dec 11, 2025

I'm still iffy on this one, so I'm going to roll another bootstrap reviewer.

@rustbot reroll

@rustbot rustbot assigned Mark-Simulacrum and unassigned jieyouxu Dec 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants